< previous page page_571 next page >

Page 571
0571-01.jpg
Figure 14.20.
Viewing help on the divide-by-zero error.
Now let's add an option that creates an error report file whenever the error handler is activated.
Adding Error Logs to the Error Handler
When errors occur, users often do not remember details that appear in the error messages. It's much more useful to create an error log on disk whenever errors occur. This enables programmers or system administrators to review the logs and see the error messages without having to be right next to the user when the error occurs.
To build error-logging features into the existing errhandler class, you need to declare two new properties (LogFileName and WriteLogFlag), create a LogError method to write the errors to a disk file, add some code to the general declarations area, the Class_Initialize and Class_Terminate events, and add a few lines to the errHandler method to call the LogError method.
First, restart the errhandler DLL project and add the code below to the general declaration section of the class module.
'
' logging storage
Private errLogFileName As String
Private errLogFlag As Boolean

 
< previous page page_571 next page >

If you like this book, buy it!